{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox-title">
        <h5>编辑合伙人类型</h5>
    </div>
    <div class="ibox-content layui-form">
        <div class="layui-row layui-col-space10 layui-form-item ">
            <input type="hidden" name="class_id" value="{$data.class_id ? $data.class_id : ''}">
            <input type="hidden" name="class_level" value="{$data.class_level ? $data.class_level : ''}">
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style="margin-left: 0px;">
                <label class="layui-form-label" style="width: 185px;">合伙人名称：</label>
                <div class="layui-input-block">
                    <input type="text" name="class_name" disabled="true" lay-verify="required" placeholder="合伙人名称" class="layui-input" value="{$data.class_name ? $data.class_name : ''}" style="width: 86%">
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style="margin-left: 0px;">
                <label class="layui-form-label" style="width: 185px;">合伙人金额：</label>
                <div class="layui-input-block">
                    <input type="text" name="class_money" lay-verify="required" placeholder="金额" class="layui-input " value="{$data.class_money ? $data.class_money : ''}" style="width: 86%">
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style="margin-left: 0px;">
                <label class="layui-form-label" style="width: 185px;">获得积分：</label>
                <div class="layui-input-block">
                    <input type="text" name="class_jifen" lay-verify="required" placeholder="积分数" class="layui-input " value="{$data.class_jifen ? $data.class_jifen : ''}" style="width: 86%">
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style="margin-left: 0px;">
                <label class="layui-form-label" style="width: 185px;">推广店铺获得千分比：</label>
                <div class="layui-input-block">
                    <input type="number" name="class_only_rate" lay-verify="required" placeholder="" class="layui-input " value="{$data.class_only_rate ? $data.class_only_rate : ''}" style="width: 86%;display: inline;"><span>‰</span>
                </div>
            </div>
            {if condition="$data.class_level == 2 || $data.class_level == 3"}
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style="margin-left: 0px;">
                <label class="layui-form-label" style="width: 185px;">合伙人数量：</label>
                <div class="layui-input-block">
                    <input type="text" name="class_num" lay-verify="required" placeholder="合伙人数量" class="layui-input " value="{$data.class_num ? $data.class_num : ''}" style="width: 86%">
                </div>
            </div>
            {/if}
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style="margin-left: 0px;">
                <label class="layui-form-label" style="width: 185px;">推广粉丝奖励时限：</label>
                <div class="layui-input-block">
                    <input type="text" name="class_fans_days" lay-verify="required" placeholder="多少天内邀请粉丝有奖励" class="layui-input " value="{$data.class_fans_days ? $data.class_fans_days : ''}" style="width: 86%;display: inline;"><span>天</span>
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style="margin-left: 0px;display: flex;">
                <label class="layui-form-label" style="width: 185px;">推广粉丝获得积分：</label>
                <div class="layui-input-block" style="margin-left: 27px;">
                    <input type="text" name="class_fans_jifen" lay-verify="required" placeholder="" class="layui-input " value="{$data.class_fans_jifen ? $data.class_fans_jifen : ''}" style="width: 50px;">
                </div>
                <label class="layui-form-label" style="width: 185px;">其中注册获得积分：</label>
                <div class="layui-input-block" style="margin-left: 27px;">
                    <input type="text" id="class_fans_jifen_reg" name="class_fans_jifen_reg" lay-verify="required" placeholder="" class="layui-input " value="{$data.class_fans_jifen_reg ? $data.class_fans_jifen_reg : ''}" style="width: 50px;">
                </div>
                <label class="layui-form-label" style="width: 185px;">完善资料获得积分：</label>
                <div class="layui-input-block" style="margin-left: 27px;">
                    <input type="text" name="class_fans_jifen_edi" disabled="true" lay-verify="required" placeholder="" class="layui-input " value="{$data.class_fans_jifen_edi ? $data.class_fans_jifen_edi : ''}" style="width: 50px;">
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style="margin-left: 0px;">
                <label class="layui-form-label" style="width: 185px;">直推获得积分：</label>
                <div class="layui-input-block">
                    <input type="text" name="class_tui_jifen" lay-verify="required" placeholder="" class="layui-input " value="{$data.class_tui_jifen ? $data.class_tui_jifen : ''}" style="width: 86%">
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style="margin-left: 0px;">
                <label class="layui-form-label" style="width: 185px;">直推获得金额：</label>
                <div class="layui-input-block">
                    <input type="text" name="class_tui_money" lay-verify="required" placeholder="" class="layui-input " value="{$data.class_tui_money ? $data.class_tui_money : ''}" style="width: 86%">
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style="margin-left: 0px;">
                <label class="layui-form-label" style="width: 185px;">代理商获得金额：</label>
                <div class="layui-input-block">
                    <input type="text" name="class_agent_money" lay-verify="required" placeholder="" class="layui-input " value="{$data.class_agent_money ? $data.class_agent_money : ''}" style="width: 86%">
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style="margin-left: 0px;">
                <label class="layui-form-label" style="width: 185px;">总部获得金额：</label>
                <div class="layui-input-block">
                    <input type="text" name="class_head_money" lay-verify="required" placeholder="" class="layui-input " value="{$data.class_head_money ? $data.class_head_money : ''}" style="width: 86%">
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style="margin-left: 0px;">
                <label class="layui-form-label" style="width: 185px;">合伙人介绍：</label>
                <div class="layui-input-block" id="LAY_editor" lay-verify="editor" style="margin-left: 185px;width: 580px;">
                    {$data.class_info ? $data.class_info : ''}
                </div>
            </div>
            
            <!-- <div class="layui-form-item layui-col-md-offset1 layui-col-md8"> -->
                <!-- <div class="layui-input-block"> -->
                    <!-- <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存 -->
                    <!-- </button> -->
                    <!-- <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">返回</button> -->
                <!-- </div> -->
            <!-- </div> -->
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //var editor = wk.wang({elem:'#LAY_editor'});
    //layui.use(['form'], function() {
    //    var form = layui.form;
    //    form.verify({
    //        editor:function(value,item){
    //            if(editor.txt.html() == '<p><br></p>'){
    //                return '请填写合伙人介绍内容';
    //            }
    //        }
    //    });
    //    
    //    $("#class_fans_jifen_reg").blur(function(){
    //        // 推荐粉丝奖励积分 = 粉丝注册奖励 + 完善资料奖励
    //        var class_fans_jifen     = $("input[ name='class_fans_jifen'] ").val();
    //        var class_fans_jifen_reg = $("input[ name='class_fans_jifen_reg'] ").val();
    //        var class_fans_jifen_edi = class_fans_jifen - class_fans_jifen_reg;
    //        if (class_fans_jifen_edi < 0) {
    //            alert('推荐粉丝获得积分 = 粉丝注册获得积分 + 完善资料获得积分');
    //            return false;
    //        }else{
    //            $("input[ name='class_fans_jifen_edi'] ").val(class_fans_jifen_edi);
    //        }
    //    })
    //    form.on('submit(component-form-element)', function (data) {
    //        data.field.html = editor.txt.html();//wangEditor
    //        // var reg = /[^0-9]/g;
    //        var reg = /^\d+(\.\d+)?$/;
    //        if (data.field.class_money && !reg.test(data.field.class_money)) {
    //            alert('金额和积分数请输入数字！');
    //            return false;
    //        }
    //        if (data.field.class_jifen && !reg.test(data.field.class_jifen)) {
    //            alert('金额和积分数请输入数字！');
    //            return false;
    //        }
	//
    //        if (data.field.class_num && !reg.test(data.field.class_num)) {
    //            alert('金额和积分数请输入数字！');
    //            return false;
    //        }
    //        if (data.field.class_tui_jifen && !reg.test(data.field.class_tui_jifen)) {
    //            alert('金额和积分数请输入数字！');
    //            return false;
    //        }
    //        if (data.field.class_agent_money && !reg.test(data.field.class_agent_money)) {
    //            alert('金额和积分数请输入数字！');
    //            return false;
    //        }
    //        if (data.field.class_head_money && !reg.test(data.field.class_head_money)) {
    //            alert('金额和积分数请输入数字！');
    //            return false;
    //        }
    //        if (data.field.class_fans_jifen && !reg.test(data.field.class_fans_jifen)) {
    //            alert('金额和积分数请输入数字！')
    //        }
    //        if (data.field.class_fans_jifen_reg && !reg.test(data.field.class_fans_jifen_reg)) {
    //            alert('金额和积分数请输入数字！')
    //        }
    //        if (data.field.class_fans_jifen_edi && !reg.test(data.field.class_fans_jifen_edi)) {
    //            alert('金额和积分数请输入数字！')
    //        }
    //        if (data.field.class_fans_days && !reg.test(data.field.class_fans_days)) {
    //            alert('金额和积分数请输入数字！')
    //        }
    //        // 事业合伙人
    //        if (data.field.class_level == 2 && !reg.test(data.field.class_tui_money)) {
    //            alert('金额和积分数请输入数字！');
    //            return false;
    //        }
	//
    //        $.ajax({
    //            url:"{:url('admin/Partners/classedit')}",
    //            type:'post',
    //            dataType:'json',
    //            data:data.field,
    //            success:function(res){
    //                if (res.code == 200) {
    //                    // layer.msg(res.msg,function(){
    //                    //     parent.layer.closeAll();
    //                    //     parent.location.reload();
    //                    // });
    //                    wk.success(res.msg,"{:url('admin/Partners/classindex')}");
    //                } else if(res.code == 300) {
    //                    wk.success(res.msg);
    //                }
    //            }
    //        })
    //    });
    //});
</script>
</body>
</html>